function Node(val) {
  this.value = val;
  this.left = null;
  this.right = null;
}

let a1 = new Node('a');
let b1 = new Node('bb');
let c1 = new Node('c');
let d1 = new Node('d');
let e1 = new Node('e');
let f1 = new Node('f');
let g1 = new Node('g');

a1.left = b1;
a1.right = c1;
b1.left = d1;
b1.right = e1;
c1.left = null;
c1.right = g1;


let a2 = new Node('a');
let b2 = new Node('b');
let c2 = new Node('c');
let d2 = new Node('d');
let e2 = new Node('ee');
let f2 = new Node('f');
let g2 = new Node('h');

a2.left = b2;
a2.right = c2;
b2.left = d2;
b2.right = e2;
c2.left = f2;
c2.right = null;

var compareList = [];

function diffFind(leftNode, rightNode) {
  if (leftNode == null && rightNode == null) return compareList;
  if (leftNode == null && rightNode != null) {
    compareList.push({
      type: "左侧没有",
      now: null,
      after: rightNode
    })
  } else if (leftNode != null && rightNode == null) {
    compareList.push({
      type: "右侧没有",
      now: leftNode,
      after: rightNode
    })
  } else if (leftNode.value != rightNode.value) {
    compareList.push({
      type: "两边不等",
      now: leftNode,
      after: rightNode
    })
  }
  if (leftNode != null && rightNode != null) {
    diffFind(leftNode.left, rightNode.left)
    diffFind(leftNode.right, rightNode.right)
  }
}

diffFind(a1, a2);
console.log(compareList);